const btn = document.querySelector("#btn")

btn.onclick = function(e){
    const username = document.querySelector("input[name=username]").value.trim()
    const password = document.querySelector("input[name=password]").value.trim()
    if( !(/^\w{6,8}$/.test(username) && /^\d{6,8}$/.test(password))){
        alert("请重新输入用户名和密码")
        e.preventDefault()
    }
}